<include file="public/layout" />
<style>
    td{height:40px;line-height:40px; padding-left:20px;}
    .span_1{
        float:left;
        margin-left:0px;
        height:130px;
        line-height:130px;
    }
    .span_1 ul{list-style:none;padding:0px;}
    .span_1 ul li{
        border:1px solid #CCC;
        height:40px;
        padding:0px 10px;
        margin-left:-1px;
        margin-top:-1px;
        line-height:40px;
    }
</style>
<body style="background-color: #FFF; overflow: auto;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <form class="form-horizontal" id="user_form" method="post">
        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">
                    <label for="balance"><em>*</em>支付宝账号</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$data.account}" name="account" id="account" class="input-txt">
                    <span class="err"></span>
                    <p class="notic">支付宝账号</p>

                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="miner"><em>*</em>收款人</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="account_name" value="{$data.account_name}"  id="account_name" class="input-txt" >
                    <span class="err"></span>
                    <p class="notic">收款人</p>

                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>二维码</label>
                </dt>
                <dd class="opt">
                    <div class="input-file-show">
                        <span class="show">
                            <a id="img_a" target="_blank" class="nyroModal" rel="gal" href="{$data.account_code}">
                                <i id="img_i" class="fa fa-picture-o" onMouseOver="layer.tips('<img src={$data.account_code}>',this,{tips: [1, '#fff']});" onMouseOut="layer.closeAll();"></i>
                            </a>
                        </span>
                        <span class="type-file-box">
                            <input type="text" id="imagetext" name="account_code" value="{$data.account_code}" class="type-file-text">
                            <input type="button" name="button" id="button1" value="选择上传..." class="type-file-button">
                            <input class="type-file-file" onClick="GetUploadify(1,'','miner','img_call_back')" size="30" hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图，点击按钮选择文件并提交表单后上传生效">
                        </span>
                    </div>
                    <span class="err"></span>
                    <p class="notic">请上传图片格式文件</p>
                </dd>
            </dl>
            <input type="hidden" name="id" value="{$id}">
            <input type="hidden" name="alipay_id" value="{$data.id}">
            <div class="bot"><a href="JavaScript:void(0);" onclick="select_goods();" class="ncap-btn-big ncap-btn-green">确认提交</a></div>
        </div>
    </form>
</div>
<script type="text/javascript">

    can_click=1;
    function select_goods()
    {
        var account = $("input[name='account']").val();
        var account_name = $("input[name='account_name']").val();
        var account_code = $("input[name='account_code']").val();
        var id = $("input[name='id']").val();
        var alipay_id = $("input[name='alipay_id']").val();

        var da = {
            'account' : account,
            'account_name' : account_name,
            'account_code' : account_code,
            'id' : id,
            'alipay_id':alipay_id
        }
     
        if(can_click==0){return false}
        can_click=0;
        $.ajax({
            type : "POST",
            url:'/index.php/Admin/World.miner/payment_method_upload',
            data : da,
            dataType: "json",
            success: function(data){
                console.log(data)
                if(data.code==1){
                    layer.alert(data.msg, {icon: 1},function () {
                        window.parent.call_back();
                        can_click=1;
                    });
                }else{
                    layer.alert(data.msg, {icon: 2},function () {
                        window.parent.call_back();
                        can_click=1;
                    });
                }

            },
            error:function(data){
                layer.alert(data, {icon: 1});
                can_click=1;
            }
        });
    }

    function clearNoNum(that){
        //清除"数字"和"."以外的字符
        var value =that.value;
        value = value.replace(/[^\d.]/g,"");
        //验证第一个字符是数字而不是
        value = value.replace(/^\./g,"");
        //只保留第一个. 清除多余的
        value = value.replace(/\.{2,}/g,".");
        value = value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
        //只能输入两个小数
        value = value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');
        value = value.substring(0,10);
        that.value=value;
    }
    function img_call_back(fileurl_tmp)
    {
        $("#imagetext").val(fileurl_tmp);
        $("#img_a").attr('href', fileurl_tmp);
        $("#img_i").attr('onmouseover', "layer.tips('<img src="+fileurl_tmp+">',this,{tips: [1, '#fff']});");
    }

</script>
</body>
</html>